// 页面导航管理类
class NavigationManager {
    constructor() {
        this.initializeButtons();
        this.bindEvents();
        this.currentPath = window.location.pathname;
    }

    // 初始化按钮元素
    initializeButtons() {
        this.userBtn = document.getElementById('user-btn');
        this.chatBtn = document.getElementById('chat-btn');
        this.friendGroupBtn = document.getElementById('friend-group-btn');
        this.searchBtn = document.getElementById('search-btn');
        this.newGroupBtn = document.getElementById('new-group-btn');
        this.infoBtn = document.getElementById('info-btn');
    }

    // 绑定导航事件
    bindEvents() {
        // 用户信息页面
        // this.userBtn?.addEventListener('click', () => {
        //     window.location.href = '../UserPage/User.html';
        // });

        // 聊天页面
        this.chatBtn?.addEventListener('click', () => {
            window.location.href = '../ChatPage/Chat.html';
        });

        // 好友和群组页面
        this.friendGroupBtn?.addEventListener('click', () => {
            window.location.href = '../FriendAndGroup/FriendAndGroup.html';
        });

        // 搜索页面
        this.searchBtn?.addEventListener('click', () => {
            window.location.href = '../SearchUserAndGroup/SearchUserAndGroup.html';
        });

        // 新建群组页面
        this.newGroupBtn?.addEventListener('click', () => {
            window.location.href = '../NewGroupPage/NewGroup.html';
        });

        // 系统信息页面
        this.infoBtn?.addEventListener('click', () => {
            window.location.href = '../SystemInfoPage/SystemInfo.html';
        });
    }
}

// 等待 DOM 加载完成后再初始化
document.addEventListener('DOMContentLoaded', () => {
    const navigationManager = new NavigationManager();
});
